xen: AMD IOMMU: Automatically enable per-device vector maps
authorGeorge Dunlap <george.dunlap@eu.citrix.com>
Tue, 26 Jul 2011 17:37:32 +0000 (18:37 +0100)
committerGeorge Dunlap <george.dunlap@eu.citrix.com>
Tue, 26 Jul 2011 17:37:32 +0000 (18:37 +0100)
Automatically enable per-device vector maps when using IOMMU,
unless disabled specifically by an IOMMU parameter.

Signed-off-by: George Dunlap <george.dunlap@eu.citrix.com>
xen/arch/x86/irq.c
xen/drivers/passthrough/amd/pci_amd_iommu.c
xen/drivers/passthrough/iommu.c

index dbd597862216ead7a9f076fbb91c879dcea9eacf..dfec057b4268ce48606c274ac979a2752cb2ca28 100644 (file)
@@ -32,6 +32,7 @@ unsigned int __read_mostly nr_irqs_gsi = 16;
 unsigned int __read_mostly nr_irqs;
 integer_param("nr_irqs", nr_irqs);
 
+/* This default may be changed by the AMD IOMMU code */
 bool_t __read_mostly opt_irq_perdev_vector_map = 0;
 boolean_param("irq-perdev-vector-map", opt_irq_perdev_vector_map);
 
index d8cc5b40e42e804e9869735132f591a6fa67f23b..797588463ed1b4d388ffae4d92bbef512cddafa4 100644 (file)
@@ -25,6 +25,9 @@
 #include <asm/amd-iommu.h>
 #include <asm/hvm/svm/amd-iommu-proto.h>
 
+extern bool_t __read_mostly opt_irq_perdev_vector_map;
+extern bool_t __read_mostly iommu_amd_perdev_vector_map;
+
 struct amd_iommu *find_iommu_for_device(int bdf)
 {
     BUG_ON ( bdf >= ivrs_bdf_entries );
@@ -148,6 +151,18 @@ int __init amd_iov_detect(void)
         return -ENODEV;
     }
 
+    /* Enable use of per-device vector map unless otherwise
+     * specified */
+    if ( iommu_amd_perdev_vector_map )
+    {
+        printk("AMD-Vi: Enabling per-device vector maps\n");
+        opt_irq_perdev_vector_map=1;
+    }
+    else
+    {
+        printk("AMD-Vi: WARNING - not enabling per-device vector maps\n");
+    }
+
     return scan_pci_devices();
 }
 
index a4bbe8ce887a78264b09fd9485a25c8eee5a58cc..7b6c2abd5fb8779824ee99f6359d6b4d2c75db1d 100644 (file)
@@ -49,6 +49,7 @@ bool_t __read_mostly iommu_qinval = 1;
 bool_t __read_mostly iommu_intremap = 1;
 bool_t __read_mostly iommu_hap_pt_share;
 bool_t __read_mostly iommu_debug;
+bool_t __read_mostly iommu_amd_perdev_vector_map = 1;
 
 static void __init parse_iommu_param(char *s)
 {
@@ -81,6 +82,8 @@ static void __init parse_iommu_param(char *s)
             iommu_dom0_strict = 1;
         else if ( !strcmp(s, "sharept") )
             iommu_hap_pt_share = 1;
+        else if ( !strcmp(s, "no-perdev-vector-map") )
+            iommu_amd_perdev_vector_map = 0;
 
         s = ss + 1;
     } while ( ss );